file object

This method will open a file for reading or writing.

bool open(string filename, string open_mode)

Parameters:
filename
The file to open. This can be either an absolute path, a relative path or the file name on its own.
open_mode
The mode in which the file should be opened (see remarks).

Return value:
true on success, false on failure.

Remarks:
When specifying a filename, remember that both \ and / can be used to specify paths.

The following is a list of valid open modes.

If the file does not exist and is opened in write or append mode, it will be created as long as the directory that should contain the file exists. If the file is being opened in read mode then both directory and file must exist for the operation to succeed.

To open a file in binary mode, simply append b to the open mode string. For example, "wb" will open a file to be written in binary mode, while "rb" opens a file to be read in binary mode.

Example:
// Write some text into a file.

void main()
{
file test;
test.open("c:\\test.txt", "w");
test.write("I am a text file!");
test.close();
}